<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head th:include="/data/header" />

<body>
    <section class="content-header">
        <h1>数据库连接</h1>
        <ol class="breadcrumb">
            <li><a href="/data/connection/index"><i class="fa fa-table"></i>列表</a></li>
            <li class="active">新增</li>
        </ol>
    </section>
    <section class="content">
    </section>
    <div class="col-sm-2 col-sm-offset-5 btn-back">
    	<a href="/data/connection/index" class="btn btn-primary btn-block">返回</a>
    </div>
    <div th:include="/data/footer" />
    <script type="text/javascript">
    var options = {
        id: "model",
        name: "新增",
        url: "/data/connection/save",
        columns: [
        	{ name: "name", title: "名称", inputType: "TEXT" },
            { name: "url", title: "URL", inputType: "TEXT", colspan:2},
            { name: "type", title: "类型", inputType: "TEXT" },
            { name: "userName", title: "用户名", inputType: "TEXT" },
            { name: "password", title: "密码", inputType: "TEXT" },
            { name: "note", title: "备注", inputType: "TEXT" }
        ]
    }

    $(function() {
        var html = generateEditHtml(options);
        $(".content").html(html);
        var model = new tonto.Model("model", options.columns, {
            pattern: "edit",
            successCallback: function() {
                $.successAlert("保存成功", function() {
                    window.location = "/data/connection/index";
                });
            }
        });
        model.setData(null);
        $.initComponment($(".content"));
    });
    </script>
</body>

</html>